#ifndef WORKPLATFORM_H
#define WORKPLATFORM_H

#include <QWidget>
#include <QtCharts/QPieSeries>
#include <QScatterSeries>
#include <QMessageBox>
#include <QtCharts>
#include <QtCharts/QChartView>
#include <QtCharts/QChart>
#include <QtCharts/QLegend>
#include <QtCharts/QPieSeries>
#include <QtCharts/QPieSlice>
#include <QtCore/QTime>
#include <QtWidgets/QGridLayout>
#include <QtCharts/QScatterSeries>
#include "utils/SerialUtil.h"
#include "utils/DemoduleUtil.h"
#include <QStandardItemModel>
#include <QDateTime>



extern SerialUtil *serialUtil;
extern DemoduleUtil *demoduleUtil;
namespace Ui {
class WorkPlatForm;
}

//Q_DECLARE_METATYPE(FIFO_Receiver);
QT_CHARTS_USE_NAMESPACE
class WorkPlatForm : public QWidget
{
    Q_OBJECT

public:
    explicit WorkPlatForm(QWidget *parent = nullptr);
    ~WorkPlatForm();
     //绘制工具面图
    void drawGJMPieChart();
    //绘制方位角倾角
   void drawFwjQjPieChart();
     //绘制施工曲线点图
    void drawLineChart();
    //设置窗体主题
    void updateUI(int theme);
    void figureDrillPosition(double courseAngle, double pitchAngle, double drillLength);
    void figureDrillPosition_1(double courseAngle, double pitchAngle, double drillLength);
    void initParam();
    void QAM_Demodulator();
    void renderData(double _CourseAngle_fy,double _PitchAngle_fy,double _RollAngle_fy);
    void save_Execel();
    void read_Excel();
    double radian2angle(int radian);
    void staticAndDynamicData(QByteArray decData);
private slots:
    void on_pushButton_2_clicked();

private:
    Ui::WorkPlatForm *ui;
    int xPos = 0;
    //散点图
    QScatterSeries* series1;
    QScatterSeries* series5;
    QChart* chart1;
    QValueAxis *axisX1, *axisY1;
    QChartView *chartView1;

    QScatterSeries* series6;
    QScatterSeries* series7;
    QChart* chart4;
    QValueAxis *axisX2, *axisY2;
    QChartView *chartView2;

    //雷达图
    QPolarChart* chart2;
    QValueAxis* angularAxis2;
    QValueAxis* radialAxis2;
    QChartView *charview2;
    QSplineSeries *series2;

    QPolarChart* chart3;
    QValueAxis* angularAxis3;
    QValueAxis* radialAxis3;
    QChartView *charview3;
    QSplineSeries *series3;
    QSplineSeries *series4;
    QSplineSeries *seriesCircle;


    double x_1 = 0, y_1 = 0 , z_1 = 0;
    double x_2 = 0, y_2 = 0 , z_2 = 0;
    FIFO_Dec fifoDec;
    FIFO_Dec_Byte fifoDecByte;
    Cout_Dec countDec;
    double CourseAngle_fy=0,PitchAngle_fy=0,RollAngle_fy=0; //航向角  俯仰角  工具面角
    double CourseAngle_fy_1=0,PitchAngle_fy_1=0,drillLength_1=0;
    double DrillLength = 0;

    int count = 0;

};

#endif // WORKPLATFORM_H
